import { CallbackQueryContext } from "puregram";
import commanderInstance from "../exports/commanderInstance";

export default async (context: CallbackQueryContext, n) => {
    const { command } = context.queryPayload;
    const commandInCommander = commanderInstance
        .getCommands()
        .find((x) => x.name === command);
    if (!commandInCommander)
        return context.answerCallbackQuery({ text: "Произошла ошибка!" });
    return commandInCommander.handler(context);
};
